/*******************************************************************************
 * Copyright (c) 2010 liw.
 * All rights reserved. 
 * 
 * This file is part of VanBus.
 * 
 *     VanBus is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 * 
 *     VanBus is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 * 
 *     You should have received a copy of the GNU General Public License
 *     along with VanBus.  If not, see <http://www.gnu.org/licenses/>.
 * Contributors:
 *     liw - initial API and implementation
 ******************************************************************************/
package org.niclab.vanbus.model.viewadpater;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.CursorAdapter;

public class CommonListAdapter extends BaseAdapter{

	private BaseAdapter delegate;
	private int resourceId;
	private Context context;
	public CommonListAdapter(Context context, int resId){
		this.resourceId = resId;
		this.context = context;
		
	}
	
	
	
	


	public int getResourceId() {
		return resourceId;
	}






	public void setResourceId(int resourceId) {
		this.resourceId = resourceId;
	}






	public Context getContext() {
		return context;
	}






	public void setContext(Context context) {
		this.context = context;
	}






	public void setBaseAdapter(BaseAdapter adapter){
		this.delegate=adapter;
				
	}
	public BaseAdapter getBaseAdapter(){
		return delegate;
	}
	
	@Override
	public int getCount() {
		if(delegate!=null)
			return delegate.getCount();
		return 0;
	}

	@Override
	public Object getItem(int position) {
		if(delegate!= null)
			return delegate.getItem(position);
		return null;
	}

	@Override
	public long getItemId(int position) {
		if(delegate!=null)
			return delegate.getItemId(position);
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		if(delegate!=null)
			return delegate.getView(position, convertView, parent);
		return null;
	}

}
